R"mustache(
#include "{{header}}"
#include "utils/hash_utils.hpp"

{{#types}}
// --- Class {{type}} Begin ---
namespace CodeGen {
template<>
struct bind_helper<{{type}}>: public bindable_base {
    bind_helper({{type}} *inst): d(inst) {}
    binddata_t get_data(const std::string &key) override final {
        binddata_t result;
        bool handled = false;
        result = do_prev_get(*d, key, &handled);
        auto hash = fnv1a_32(key.c_str(), key.length());
        switch(hash) {
            // --- Fields Begin ---
            {{#fields}}
            case "{{field_key}}"_hash: result = make_data(d,&{{type}}::{{field_name}}); break;
            {{/fields}}
            // --- Fields End ---

            // --- Methods Begin ---
            {{#methods}}
            case "{{method_key}}"_hash: result = make_data(d,&{{type}}::{{method_name}}); break;
            {{/methods}}
            // --- Methods End ---

            default: result = do_post_get(*d, key, &handled);
        }
        return result;
    }
private:
    {{type}} *d;
};
}
bindable_base *{{type}}::create_binddata({{type}} *inst) {
    return new CodeGen::bind_helper<{{type}}>(inst);
}
// --- Class {{type}} End ---

{{/types}}
)mustache"
